<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>管理系统|修改密码</title>
		<!-- Tell the browser to be responsive to screen width -->
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<!-- Bootstrap 3.3.7 -->
		<link rel="stylesheet" href="/Public/bower_components/bootstrap/dist/css/bootstrap.min.css">
		<!-- Font Awesome -->
		<link rel="stylesheet" href="/Public/bower_components/font-awesome/css/font-awesome.min.css">
		<!-- Ionicons -->
		<!-- DataTables -->
		<link rel="stylesheet" href="/Public/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">

		<link rel="stylesheet" href="/Public/bower_components/Ionicons/css/ionicons.min.css">
		<!-- Theme style -->
		<link rel="stylesheet" href="/Public/dist/css/AdminLTE.min.css">
		<!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
		<link rel="stylesheet" href="/Public/dist/css/skins/_all-skins.min.css">
		<!--bootstrapValidator-->
		<link rel="stylesheet" href="/Public/plugins/bootstrap-validator/dist/css/bootstrapValidator.min.css" />
		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

		<!-- Google Font -->
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
	</head>

	<body class="hold-transition skin-blue sidebar-mini">
		<!-- Site wrapper -->
		<div class="wrapper">

			 <header class="main-header">
    <!-- Logo -->
    <a href="index2.html" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <span class="logo-mini"><b>权限</b>管理</span>
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg"><b>权限</b>管理系统</span>
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- Sidebar toggle button-->
      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <!-- User Account: style can be found in dropdown.less -->
          <li class="dropdown user user-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <img src="{$result.picture}" class="user-image" alt="User Image">
              <span class="hidden-xs">{$result.nickname}</span>
            </a>
            <ul class="dropdown-menu">
              <!-- User image -->
              <li class="user-header">
                <img src="{$result.picture}" class="img-circle" alt="User Image">

                <p>
                  {$result.uname}
                  <small>{$result.nickname}</small>
                </p>
              </li>
              <!-- Menu Footer-->
              <li class="user-footer">
                <div class="pull-right">
                  <a href="#" class="btn btn-default btn-flat">退出登录</a>
                </div>
              </li>
            </ul>
          </li>
          <!-- Control Sidebar Toggle Button -->
          <li>
            <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
          </li>
        </ul>
      </div>
    </nav>
  </header>
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <!-- Sidebar user panel -->
      <div class="user-panel">
        <div class="pull-left image">
          <img src="{$result.picture}" class="img-circle" alt="User Image">
        </div>
        <div class="pull-left info">
          <p>{$result.nickname}</p>
          <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
        </div>
      </div>
      <!-- search form -->
      <form action="#" method="get" class="sidebar-form">
        <div class="input-group">
          <input type="text" name="q" class="form-control" placeholder="搜索...">
          <span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
        </div>
      </form>
      <!-- /.search form -->
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu" data-widget="tree">
        <li class="header">主菜单</li>
      </ul>
    </section>
    <!-- /.sidebar -->
  </aside>
  
			<!-- =============================================== -->

			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					<h1>
        修改密码
        <small>it all starts here</small>
      </h1>
					<ol class="breadcrumb">
						<li>
							<a href="#"><i class="fa fa-dashboard"></i> Home</a>
						</li>
						<li>
							<a href="#">Examples</a>
						</li>
						<li class="active">Blank page</li>
					</ol>
				</section>

				<!-- Main content -->
				<section class="content">
					<div class="row">
						<div class="col-xs-12">
							<div class="box">
								<div class="box-header">
									<h3 class="box-title">Data Table With Full Features</h3>
								</div>
								<!-- /.box-header -->
								<div class="box-body">
									<form id="updateform" class="form-horizontal">
										<div class="box-body">
											<div class="callout callout-success hide" id="tishi">
												<h4>成功!</h4>
												<p>请记住密码！(2s后自动消失)</p>
											</div>
											<div class="callout callout-danger hide" id="tishi">
												<h4>失败!</h4>
												<p>请重新提交！(2s后自动消失)</p>
											</div>
											<div class="form-group">
												<label for="inputEmail3" class="col-sm-2 control-label">账号</label>
												<div class="col-sm-10">

													<input type="text" class="form-control" name="uname" id="uname" placeholder="账号" readonly="readonly" value="{$result.uname}">
												</div>
											</div>
											<div class="form-group">
												<label for="inputEmail3" class="col-sm-2 control-label">原密码</label>
												<div class="col-sm-10">
													<input type="password" class="form-control" name="oldpassword" id="oldpassword" placeholder="原密码">
												</div>
											</div>
											<div class="form-group">
												<label for="inputPassword3" class="col-sm-2 control-label">新密码</label>
												<div class="col-sm-10">
													<input type="password" class="form-control" name="password" id="password" placeholder="新密码">
												</div>
											</div>
											<div class="form-group">
												<label for="inputPassword3" class="col-sm-2 control-label">确认新密码</label>
												<div class="col-sm-10">
													<input type="password" class="form-control" name="repassword" id="repassword" placeholder="再次输入新密码">
												</div>
											</div>
										</div>
										<!-- /.box-body -->
										<div class="box-footer">
											<button id="submitbt" type="submit" class="btn btn-info pull-right">确定</button>
										</div>
										<!-- /.box-footer -->
									</form>
									<!--<form action="http://127.0.0.1:8006/home/user/updateitem/uid/" method="post">
              	<input type="hidden" name="uid" id="uid" value="{$result.uid}" />
              	<p>用户账号:<input type="text" name="uname" id="uname" value="{$result.uname}" readonly="readonly"/>
              	</p>
              	<p>原密码:<input type="password" name="oldpassword" id="oldpassword" value="" /></p>
              	<p>新密码:<input type="password" name="password" id="password" value="" /></p>
              	<p>确认新密码:<input type="password" name="repassword" id="repassword" value="" /></p>
              	<div class="btn-group"><input type="submit" value="修改" class="btn btn-default"/></div>
              </form>-->
								</div>
								<!-- /.box-body -->
							</div>
							<!-- /.box -->
						</div>
						<!-- /.col -->
					</div>
					<!-- /.row -->
				</section>
				<!-- /.content -->
			</div>
			<!-- /.content-wrapper -->

			<footer class="main-footer">
				<div class="pull-right hidden-xs">
					<b>Version</b> 2.4.0
				</div>
				<strong>Copyright &copy; 2014-2016 <a href="https://adminlte.io">Almsaeed Studio</a>.</strong> All rights reserved.
			</footer>

			<!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
			<div class="control-sidebar-bg"></div>
		</div>
		<!-- ./wrapper -->

		<!-- jQuery 3 -->
		<script src="/Public/bower_components/jquery/dist/jquery.min.js"></script>
		<!-- Bootstrap 3.3.7 -->
		<script src="/Public/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<!-- SlimScroll -->
		<script src="/Public/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
		<!-- DataTables -->
		<script src="/Public/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
		<script src="/Public/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>

		<!-- FastClick -->
		<script src="/Public/bower_components/fastclick/lib/fastclick.js"></script>
		<!-- AdminLTE App -->
		<script src="/Public/dist/js/adminlte.min.js"></script>
		<!-- AdminLTE for demo purposes -->
		<script src="/Public/dist/js/demo.js"></script>
		<!--bootstrapValidator-->
		<script src="/Public/plugins/bootstrap-validator/dist/js/bootstrapValidator.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/Public/js/loadmenu.js" type="text/javascript" charset="utf-8"></script>
		
		<script>
			$(document).ready(function() {
				$('.sidebar-menu').tree();
				$(".treeview:nth-child(2)").addClass("active");
				$(".treeview:nth-child(2)").addClass("menu-open")
				$(".active .treeview-menu").css("display","block");
				$(".active .treeview-menu li").last().addClass("active");
				$("#out").on("click",function(){
//					$.ajax({
//						type:"post",
//						url:"/home/user/",
//						async:true
//					});
				})
				$("#updateform").bootstrapValidator({
					message: 'This value is not valid',
					feedbackIcons: {
						valid: 'glyphicon glyphicon-ok',
						invalid: 'glyphicon glyphicon-remove',
						validating: 'glyphicon glyphicon-refresh'
					},
					fields: {
						oldpassword: {
							validators: {
								notEmpty: {
									message: '请输入原始密码'
								}
							}
						},
						password: {
							validators: {
								notEmpty: {
									message: '请输入新密码'
								},
								different: {
									field: 'oldpassword',
									message: '新密码与旧密码不能相同'
								}
							}
						},
						repassword: {
							validators: {
								notEmpty: {
									message: '请再次输入新密码'
								},
								identical: {
									field: 'password',
									message: '重复输入与新密码不相同'
								}
							}
						},
					}

				}).on('success.form.bv', function(e) {
					// Prevent form submission
					e.preventDefault();
					// Get the form instance
					var $form = $(e.target);
					// Get the BootstrapValidator instance
					var bv = $form.data('bootstrapValidator');
					// Use Ajax to submit form data
					$.post($form.attr('action'), $form.serialize(), function(result) {
						if(result.code == 0) {
							$(".callout-danger").addClass("hide");
							$(".callout-success").removeClass("hide");
						} else {
							$(".callout-success").addClass("hide");
							$(".callout-danger").removeClass("hide");
						};
						setTimeout(function(){
							  $(".callout-success").fadeOut(500);
							$(".callout-danger").fadeOut(500);
							},2000);
						$("#submitbt").removeAttr("disabled");
					}, 'json');
				})
				$("#out").on("click",function(){
        	$.ajax({
        		type:"post",
        		url:"/home/user/out",
        		data:{
        			"out":"out"
        		},
        		success:function(data){
        			location.href="/home/index/login";
        		}
        	});
        })
			})
		</script>
	</body>

</html>